#include <iostream>
#include <vector>
using namespace std;

class BarCode
{
    public:
        BarCode(int code[]);
        BarCode(char code[]);
        int outputInt();
        void outputString() const;
    private:
        int initCode[5] = {0, 0, 0, 0, 0};
        int translateCode[5] = {7, 4, 2, 1, 0};
        int result = 0;
};

int main()
{
    int example_code[5];
    for (int i = 0; i < 5; i++)
        cin >> example_code[i];

    BarCode code1(example_code);
    code1.outputString();
    int result = code1.outputInt();
    cout << "The result is " << result << endl;

    return 0;
}


BarCode::BarCode(int code[]) {
    for (int i = 0; i < 5; i++)
        initCode[i] = code[i];
}

BarCode::BarCode(char code[]) {
    for (int i = 0; i < 5; i++) 
        initCode[i] = code[i] - '0';
}

void BarCode::outputString() const 
{
    cout << "The initial code is ";
    for (int i = 0; i < 5; i++)
        cout << initCode[i];
    cout << endl;
}

int BarCode::outputInt()
{
    int result = 0;
    for (int i = 0; i < 5; i++)
        result += initCode[i] * translateCode[i];
    return result;
}